<%@page import="org.apache.commons.lang.WordUtils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="org.swim.web.utils.*"%>
<%@page import="java.util.List"%>
<%@page import="org.swim.remote.entities.IAbility"%>
<%
	List confirmedAbilities = (List) request
			.getAttribute("confirmedAbilities");
	List requestedAbilities = (List) request
			.getAttribute("requestedAbilities");
	List rejectedAbilties = (List) request
			.getAttribute("rejectedAbilities");

	IAbility ability;
%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@include file="include/header.jsp"%>
<title><%=SwimConst.getTitle("Administration login")%></title>
<style type="text/css">
#modAbility .btn.disabled {
	opacity: 0.6;
}
</style>
</head>
<body onload="$('#modAbility').hide();">
	<%@include file="include/error-handling.jsp"%>
	<div class="container">
		<div style="text-align: center; margin-top: 30px">
			<h3>Swim 2.0 Administration</h3>
			<div class="row">
				<div class="span4" id="addAbility">
					<form method="post"
						action="<%=SwimConst.Url.Servlet.ADMIN%>?a=<%=Action.ADDNEWABILITY.name().toLowerCase()%>">
						<div class="btn-group input-append">
							<input style="margin-bottom: 5px" autocomplete="off"
								placeholder="Type name of new ability" class="span3" type="text"
								name="name">
							<button type="submit" class="btn">Add</button>
						</div>
					</form>
				</div>
				<div class="span8" id="modAbility">
					<form method="post"
						action="<%=SwimConst.Url.Servlet.ADMIN%>?a=<%=Action.CHANGEABILITYSTATUS.name().toLowerCase()%>">
						<input type="hidden" name="abilityId"> <input
							type="hidden" name="status"> <span id="name">Name
							Ability</span> <i class="icon-chevron-right"></i> <span
							class="btn-group"><a class="disabled btn btn-success"
							href="javascript: setStatusAndSubmit('CONFIRMED')">Confirmed</a><a
							class="btn btn-warning"
							href="javascript: setStatusAndSubmit('REQUESTED')">Requested</a><a
							class="btn btn-danger"
							href="javascript: setStatusAndSubmit('REJECTED')">Rejected</a></span>
					</form>
				</div>
			</div>
			<div class="row-fluid">
				<div class="span4">
					<h5>Confirmed abilities</h5>
					<table class="table">
						<%
							for (int i = 0; i < confirmedAbilities.size(); i++) {
								ability = (IAbility) confirmedAbilities.get(i);
						%>
						<tr class="success">
							<td><a
								href="javascript:loadAbilityStatus('<%=SwimUtils.capitalizeFirstChar(ability.getName()
						.toLowerCase())%>', <%=ability.getId()%>, '<%=ability.getStatus()%>')"><%=SwimUtils.capitalizeFirstChar(ability.getName()
						.toLowerCase())%></a></td>
						</tr>
						<%
							}
						%>
					</table>
				</div>
				<div class="span4">
					<h5>Requested abilities</h5>
					<table class="table">
						<%
							for (int i = 0; i < requestedAbilities.size(); i++) {
								ability = (IAbility) requestedAbilities.get(i);
						%>
						<tr class="warning">
							<td><a
								href="javascript:loadAbilityStatus('<%=SwimUtils.capitalizeFirstChar(ability.getName()
						.toLowerCase())%>', <%=ability.getId()%>, '<%=ability.getStatus()%>')"><%=SwimUtils.capitalizeFirstChar(ability.getName()
						.toLowerCase())%></a></td>
						</tr>
						<%
							}
						%>
					</table>
				</div>
				<div class="span4">
					<h5>Rejected abilities</h5>
					<table class="table">
						<%
							for (int i = 0; i < rejectedAbilties.size(); i++) {
								ability = (IAbility) rejectedAbilties.get(i);
						%>
						<tr class="error">
							<td><a
								href="javascript:loadAbilityStatus('<%=SwimUtils.capitalizeFirstChar(ability.getName()
						.toLowerCase())%>', <%=ability.getId()%>, '<%=ability.getStatus()%>')"><%=SwimUtils.capitalizeFirstChar(ability.getName()
						.toLowerCase())%></a></td>
						</tr>
						<%
							}
						%>
					</table>
				</div>
			</div>
		</div>
	</div>
	<%@include file="include/footer.jsp"%>
	<%@include file="include/script-common.jsp"%>
</body>
</html>